package com.ymatou.iapi.dguser.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.captcha.parameter.GetValidateCodeBean;
import com.ymatou.iapi.captcha.service.GetValidateCodeCall;
import com.ymatou.iapi.dguser.parameter.ReceiveCreateBackUserBean;
import com.ymatou.iapi.dguser.parameter.UserCreateBean;
import com.ymatou.iapi.dguser.service.ReceiveCreateBackUserCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.DGUserCallService;
import com.ymttest.business.service.ValidateCodeServiceV2;

/**
 * 后台创建用户（回调）Test FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_ReceiveCreateBackUser {
	private static ReceiveCreateBackUserBean receivecreatebackuserBean;
	private static ReceiveCreateBackUserCall receivecreatebackuserCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("后台创建用户（回调）Test");
	}

	@Before
	public void caseUp() {
		receivecreatebackuserBean = new ReceiveCreateBackUserBean();
		receivecreatebackuserCall = new ReceiveCreateBackUserCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(receivecreatebackuserCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ReceiveCreateBackUser_001() {
		Logger.start(true, "创建商家用户，成功");
		try {
			UserCreateBean u = DGUserCallService.initSellerUsercreateBean();
			u.setUserType(1);
			Integer user = DGUserCallService.UserCreateCall(u);
			//生成验证码 ActionUser：MobileAreaCode_Mobile validatetype: 17
			receivecreatebackuserBean.setHpAccount("hpAccount");
			receivecreatebackuserBean.setMchId(user);
			receivecreatebackuserBean.setWxAppId("wxAppId");
			receivecreatebackuserBean.setWxAppIdApp("wxAppIdApp");
			receivecreatebackuserBean.setWxAppIdBuyer("wxAppIdBuyer");
			receivecreatebackuserBean.setWxAppIdH5("wxAppIdH5");
			receivecreatebackuserBean.setWxAppIdPc("wxAppIdPc");
			receivecreatebackuserBean.setWxSecret("wxSecret");
			receivecreatebackuserBean.setWxSecretApp("wxSecretApp");
			receivecreatebackuserBean.setWxSecretBuyer("wxSecretBuyer");
			receivecreatebackuserBean.setWxSecretH5("wxSecretH5");
			receivecreatebackuserBean.setWxSecretPc("wxSecretPc");

			receivecreatebackuserCall.setData(receivecreatebackuserBean);
			receivecreatebackuserCall.callService();
			Logger.verifyEquals("ok",receivecreatebackuserCall.getReturnData(), "验证回调是否成功");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}